package mymyoux.events
{
	import flash.events.Event;
	
	import mymyoux.io.Parameters;

	public class LoadEvent extends Event implements IStaticListenable
	{
		static public const ALL_EVENTS:String="Load_Events";
				static public const ERROR:String="error";
		static public const LOADING:String="loading";
		static public const OPEN:String="open";
		static public const COMPLETED:String="scompleted";
		protected var _status:String,_url:String;
		protected var _value:*;
		protected var _parameters:Parameters;
		protected var _loadedBytes:uint,_totalBytes:uint;
		public function LoadEvent(url:String,parameters:Parameters,status:String,value:*=null,loadedBytes:uint=0,totalBytes:uint=0,bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(status, bubbles, cancelable);
			_status=status;
			_value=value;
			_loadedBytes=loadedBytes;
			_totalBytes=totalBytes;
			_url=url;
			if(parameters==null){
				parameters=new Parameters();
			}
			_parameters=parameters;
		}
		public function get url():String{
			return _url;
		}
		public function get parameters():Parameters{
			return _parameters;
		}
		public function get status():String{
			return _status;
		}
		public function get value():*{
			return _value;
		}
		public function get loadedBytes():uint{
			return _loadedBytes;
		}
		public function get totalBytes():uint{
			return _totalBytes;
		}
		 /**
		 * @copy mymyoux.core.IObject#toString()
		 */
		public override function toString():String{
			return "[Load"+super.toString().substring(1,super.toString().length-1)+" status=\""+_status+"\" loadedBytes="+_loadedBytes+" totalBytes="+_totalBytes+"\nurl=\""+_url+"\"\nargs=\""+_parameters+"\"\nvalue=\""+_value+"\"]]";
		}
		/**
		 * @inheritDoc 
		 */
		 public override function clone():Event
		 {
		 	return new LoadEvent(_url,_parameters,_status,_value,_loadedBytes,_totalBytes,bubbles,cancelable);
		 }
	}
}